The present invention relates generally to object-oriented data management within a framework of distributed transaction processing computer systems. More specifically, the present invention is a method and apparatus for providing concurrent access to a dictionary in such computer systems.
Dictionaries in data processing -systems include data structures in which entries may be key-searched, inserted, modified or deleted. Hereafter, data processing systems with dictionaries are referred to as xe2x80x9cdictionary systems.xe2x80x9d
Object-oriented dictionary systems merge the capability of object-oriented programming languages and dictionary management functions. An object-oriented programming language is employed to handle the dictionary design, access and applications. In such object-oriented dictionary systems, dictionaries are a fundamentally useful type of programming objects. Thus, it is helpful to first understand the object abstraction concept.
A programming language is defined as object-oriented if it allows direct modeling of objects in the real world, such as dictionary entries, bank accounts information, product inventory, etc. Object-oriented programming also supports classes that allow inheritance, as will be further explained below.
Objects, as used in the context of object-oriented programming, are basic building blocks analogous to data structure types in other programming languages. Objects may be simple or complex in form. Simple objects are, for instance, integers, real numbers, a string of characters, an array of strings, pointers, etc. Complex objects, are defined as programmatic combinations of data elements and methods. In other words, such objects are generally defined as a programmatic combination of member data elements, possibly themselves simple or complex objects, and a set of member operations known as methods. Methods are internal algorithms that represent the internal implementation of an object and are performed by the object after receiving a message which is analogous to a function call. An object performing a method in response to a message produces an effect that may be remembered as a state of the object.
In object-oriented programming, classes are used to introduce new data structure types into a program. A class definition includes the keyword xe2x80x9cclassxe2x80x9d followed by a name or tag of the class, which is used to represent the new data structure type. The class definition also includes an aggregation of data structures, possibly of different types, a set of algorithms and an external interface.
Classes describe an aggregation of objects, a set of methods, and messages. Each object is an instance, referenced by a name, of a certain class and all objects in a class share the same structure and respond to the same class message and methods. Objects can be passed by value as the argument and return type of a function. A pointer to an object can be initialized or assigned the result of a pointer operator.
Classes may form a hierarchy consisting of a root or base class at the top and its subclasses. The root or base class is a super-class to its subclasses, and each subclass is a super-class to its subclasses, if any. Each subclass inherits the functionality of all its super-classes in the hierarchy. By reason of the inheritance mechanism, subclasses need to define only aspects of their implementation that are different or in addition to the implementation of their respective super-classes.
The class abstraction provides a basic foundation for object-oriented programming. The classes themselves are objects that may be contained in variable instances of a program. As part of the class abstraction, objects and methods that occur in a public section of the class body provide the public interface of the class and can be accessed from anywhere within the main program. Objects and methods that occur in a protected or private section of the class body can be accessed only by the member methods of the class. In other words, private members of a class object can be manipulated only by the class object itself, or class objects declared as friends of the class object. This access restriction is referred to as information hiding or encapsulation.
An object-oriented program design, therefore, identifies the classes, or candidate abstractions, of the problem domain, and the supporting abstractions of the implementation, as well as the relationship between the classes. The object-oriented program design additionally identifies the interfaces to these classes. For example, an object-oriented dictionary design may identify the class hierarchy of dictionary entries and manipulation thereof, as well as the interface to these classes. Once, these abstractions are identified, a prototype implementation of the dictionary can proceed.
In a distributed transaction processing environment that implements an object-oriented dictionary (hereafter xe2x80x9cdictionaryxe2x80x9d), the search, insert, modify, or delete operations are made within the framework of transactions launched by respective applications. Within this framework, the dictionary may be implemented as a transaction resource.
To understand the nature of transaction resources, it is helpful to first understand the transaction abstraction concept. A transaction is a unit of work characterized as a collection of operations for transforming a physical and abstract state of an application program in a transactional execution environment.
An application program is a static sequence of instructions. A process is a dynamic invocation of the application program along with the resources required for the application program to run. The process is essentially a running instance of the application program. The process is defined as having a thread and a state. The state is a value handled by the process and a memory space designated for the value. A thread is a unit of execution forming a flow of control within the process. A process may have one or multiple threads, and is accordingly referred to as a single-threaded process or multithreaded process, respectively.
A running instance of a transaction program is a process that services a class of transaction input messages. During transaction program runtime, a transaction is invoked by a thread of the respective process. Operations performed thereafter by the transaction program and other programs in service of the transaction program, are part of this transaction. The thread also calls for termination of this transaction.
A multithreaded process has multiple flows of control, or threads, sharing the same global state and taking turns in utilizing processor execution cycles. In a multithreaded process, each thread is associated with at most one transaction since no thread is associated with any transaction before beginning, between or after termination of transactions. When an application launches a multithreaded process, activities of the different transactions may interfere with each other.
Unfortunately, concurrency control does not protect against problems that occur if more than one transaction attempts to access the same data simultaneously. In traditional implementations, interference between transactions are managed by limiting access to a transaction resources to a single transaction at a time. Namely, to maintain consistency of the data in the transaction resource until the disposition (completion or failure) of the transaction is determined, traditional implementations lock the data to prevent more than one transaction from accessing it. Thus, only a single process or thread may access a particular dictionary at a particular time. It is easily appreciated, however, that the usefulness of the dictionary is greatly enhanced if it can perform work on behalf of multiple concurrent transactions. Specifically, provision of concurrent access ensures that the dictionary does not become a barrier that forces multiple concurrent processes to serialize.
In accordance with the purpose of the invention, as embodied and broadly described herein, the invention relates to a dictionary in a data processing system, and to a method and a computer program product, for providing access to the dictionary.
A preferred embodiment of the present invention provides the dictionary in a distributed transaction processing system. The dictionary is implemented as an escrow-locking multithreaded process-pair resource manager (PPRM) dictionary. The escrow-locking multithreaded PPRM dictionary is produced as an escrow-locking object implemented in the context of a PPRM and inheriting its functionality.
A process pair in the PPRM is responsive to multiple concurrent transactions and including a concurrent aspect, a serial aspect and an escrow-locking dictionary. The concurrent aspect is a front-end multithreaded process of the process pair for concurrently servicing the multiple concurrent transactions. The serial aspect is a single-threaded process of the process pair for serializing the multiple concurrent transactions. Each of the concurrent aspect and the serial aspect includes an instance of the escrow-locking dictionary. That is, each of the concurrent aspect and the serial aspect has it own copy of the escrow-locking dictionary and, combined, the two copies maintain an appearance of a single virtual dictionary.
The escrow-locking dictionary has a dictionary resource and uses escrow-locking for allowing the multiple concurrent transactions to share the dictionary resource. As a result, the dictionary performs operations on behalf of the multiple concurrent transactions without compromising their atomic, consistent, isolated and durable (ACID) properties.
In further accordance with the purpose of the invention, as embodied and broadly described herein, the invention provides a method and a computer program product, including a computer useable medium having computer readable code embodied therein, for providing access to the dictionary in the data processing system. In providing the access, the method and computer program product (hereafter collectively referred to as the xe2x80x9cmethod and productxe2x80x9d) include providing the dictionary in the data processing system. The dictionary is implemented as an escrow-locking multithreaded process-pair resource manager (PPRM) dictionary and includes the concurrent aspect, the serial aspect, and the escrow-locking dictionary.
The method and product additionally include using in the dictionary exclusive and shared locking in response to access request messages and a distributed transaction processing two-phased commit protocol to process the access request messages. Furthermore, the method and product include keeping track in the operations performed in response of the access request messages on behalf of each of one or multiple concurrent transactions. The access request messages prompt a recording of the operations and reply messages in a per-transaction record in the order in which they are addressed by the concurrent aspect.
The method and product also include providing the per-transaction record for each transaction to the serial aspect. The serial aspect serializes and replays the multiple concurrent transactions to which the concurrent aspect is responsive using as an input their respective per-transaction records. The method and product further include keeping track in the dictionary of dictionary entries being accessed so that conflicting operations may be blocked until a transaction that perform these operations has completed them. As a result, the dictionary services the multiple concurrent transactions without compromising their atomic, consistent, isolated and durable (ACID) properties.
Advantages of the invention will be set forth, in part, in the description that follows and, in part, will be understood by those skilled in the art from the description herein. The advantages of the invention will be realized and attained by means of the elements and combinations particularly pointed out in the appended claims and equivalents.